﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.Style
{
    #region Using Statements

    using System.Collections.Generic;

    #endregion

    public class MediaList
    {
        #region Attributes

        public List<string> List { get; set; }

        #endregion

        #region Constructors

        public MediaList()
        {
            List = new List<string>();
        }

        #endregion

        #region DOM Level 2 Style Compliance

        /// <summary>
        /// Adds the medium newMedium to the end of the list. If the newMedium
        /// is already used, it is first removed. 
        /// </summary>
        /// <param name="newMedium">The new medium to add.</param>
        public void appendMedium(string newMedium)
        {
        }

        /// <summary>
        /// Deletes the medium indicated by oldMedium from the list. 
        /// </summary>
        /// <param name="oldMedium">The medium to delete in the media list.</param>
        public void deleteMedium(string oldMedium)
        {
        }

        /// <summary>
        /// Returns the indexth in the list. If index is greater than or equal
        /// to the number of media in the list, this returns null. 
        /// </summary>
        /// 
        /// <param name="index">Index into the collection.</param>
        /// 
        /// <returns>The medium at the indexth position in the MediaList, or null 
        /// if that is not a valid index.</returns>
        public string item(int index)
        {
            return index < 0 || index > List.Count ? null : List[index];
        }

        /// <summary>
        /// The number of media in the list. The range of valid media is 0 to 
        /// length-1 inclusive.
        /// </summary>
        public int length
        {
            get
            {
                return List.Count;
            }
        }

        /// <summary>
        /// The parsable textual representation of the media list. This is a 
        /// comma-separated list of media.
        /// </summary>
        public string mediaText { get; set; }

        #endregion
    }
}
